package com.sykj.util;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class CustomExceptionRestController {
	
	
	@ExceptionHandler(NullPointerException.class)
	public ResponseResult systemException(NullPointerException e){
		return new ResponseResult(-1000,"对象不存在",false,null);
	}
	
	@ExceptionHandler(CoustomException.class)
	public ResponseResult  customException(CoustomException e){
		return new ResponseResult(e.getCode(),e.getMessage(),false,null);
	}

}
